{% extends "page_template.html" %}
{% block title %}page top{% endblock %}
{% block head %}
<link rel="stylesheet" href="../static/goods_detail.css">
{{super()}}
{% endblock %}

{% block contents %}
  <section class=goods_detail>
    <h1>商品の詳細</h1>
    {% for g in good %}
    <h2>出品者</h2>
    <h2>{{g.username}}</h2>
    <h2>商品名</h2>
    <h2>{{g.goods_name}}</h2>
    <h2>レンタル料</h2>
    <h2>{{g.rental_fee}}</h2>
    <h2>説明</h2>
    <h2>{{g.description}}<h2>
    <h2>画像</h2>
    <br>
      <img src=/{{g.filepath1}} width=200px height=200px>
    <br>
    <form method="POST" action="/rental_done" enctype="multipart/form-data">
    <input value="レンタルする！" type="submit"/ onClick="disp()">
    <input type="hidden" name="goods_id" value={{g.goods_id}}>
    <input type="hidden" name="lender_id" value={{g.id}} >
    <input type="hidden" name="borrower_id" value={{current_user.id}} >
    <input type="hidden" name="price" value={{g.rental_fee}}>
    </form>
    {% endfor %}
  </section>

  <script>
  function disp(){
    window.alert("レンタル完了です。\n直ちに連絡をとってください")
  }
  </script>
{% endblock %}

{% block footer %}
  <p><a href="/top_page">TOPへ</a></p>
{% endblock %}
